package com.syt.hospital.controller;

import com.syt.exception.SYTException;
import com.syt.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: xxx
 * @Date: 2023/2/4 10:01
 * @Description: 模拟异常
 */
@Api(tags = "模拟异常")
@RestController
@RequestMapping("/exception")
public class TestController {
    
    @ApiOperation(value = "异常失败")
    @PostMapping()
    public Result exception(){
        try {
            int i=1/0;
        } catch (Exception e) {
           throw  new SYTException("测试int i=1/0失败", 201);
        }
        return Result.ok();
    }
}
